Creates a Task that executes an end
method function when a specified IAsyncResult completes.
Namespace:
System.Threading.Tasks
Assembly:
System.Threading (in System.Threading.dll)
Syntax
Visual Basic (Declaration) |
---|
Public Function FromAsync ( _
asyncResult As IAsyncResult, _
endMethod As Func(Of IAsyncResult, TResult), _
creationOptions As TaskCreationOptions _
) As Task(Of TResult) |
C# |
---|
public Task<TResult> FromAsync(
IAsyncResult asyncResult,
Func<IAsyncResult, TResult> endMethod,
TaskCreationOptions creationOptions
) |
Parameters
- asyncResult
- Type: System..::.IAsyncResult
The IAsyncResult whose completion should trigger the processing of the
endMethod.
- endMethod
- Type: System..::.Func<(Of <(IAsyncResult, TResult>)>)
The function delegate that processes the completed asyncResult.
- creationOptions
- Type: System.Threading.Tasks..::.TaskCreationOptions
The TaskCreationOptions value that controls the behavior of the
created Task.
Return Value
A
Task that represents the
asynchronous operation.
Exceptions
Exception | Condition |
---|
System..::.ArgumentNullException | The exception that is thrown when the
asyncResult argument is null. |
System..::.ArgumentNullException | The exception that is thrown when the
endMethod argument is null. |
System..::.ArgumentOutOfRangeException | The exception that is thrown when the
creationOptions argument specifies an invalid TaskCreationOptions
value. |
See Also